feat(deploy): add SPA fallback redirect for Cloudflare Pages#5
Merged
Conversation
Without this, deep links like /preview/<id> return 404 because Pages looks for a literal file. The wildcard rewrite to /index.html lets TanStack Router handle routing client-side. Real files (templates.json, assets, etc.) are still served before the redirect runs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
resumex | 269fd87 | May 01 2026, 09:34 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
public/_redirectsso Cloudflare Pages servesindex.html(200) for any path that doesn't match a real file. Without this, deep links like/preview/<id>return a literal 404 because Pages looks for a file at that path before falling back to SPA routing.Real files (
templates.json,_headers,assets/*) are still served before the redirect runs, so static assets and the manifest are unaffected.Re-applies fb15c80, which was accidentally pushed direct to main earlier in the session; main was reverted in 3aa3fff so this PR re-introduces the change cleanly.
Test plan
pnpm build— confirmeddist/_redirectsis emittedcurl -I https://resumex.karnstack.com/preview/minimal-monoreturns200curl -I https://resumex.karnstack.com/templates.jsonstill serves the manifest (file beats redirect)/still redirects to GitHub (public mode beforeLoad)🤖 Generated with Claude Code